package net.simflow.swf.analyzer.chart;

import java.util.ArrayList;
import java.util.TreeMap;

import net.simflow.swf.analyzer.data.DataPkg;
import net.simflow.swf.analyzer.network.data.Flow;
import net.simflow.swf.analyzer.network.data.Node;
import net.simflow.swf.analyzer.network.stats.data.NetworkStats;

import org.eclipse.swt.widgets.Display;

public class NetworkStatsChart {

	private static NetworkStatsChart instance = new NetworkStatsChart();

	private NetworkStatsChart() {
	}

	public static NetworkStatsChart getInstance() {
		return instance;
	}

	public void create(String style, Display display, String title,
			String xAxisTitle, String yAxisTitle, DataPkg dataPkg) {
		try {
			title = title + ": " + style;
			switch (style) {
			case NetworkStats.NAME:
				this.createNameChart(style, display, title, xAxisTitle,
						yAxisTitle, dataPkg);
				break;
			case NetworkStats.FLOW:
				this.createFlowSetChart(style, display, title, xAxisTitle,
						yAxisTitle, dataPkg);
				break;
			case NetworkStats.NODE:
				this.createNodeSetChart(style, display, title, xAxisTitle,
						yAxisTitle, dataPkg);
				break;
			case NetworkStats.SERVICE:
				this.createServiceSetChart(style, display, title, xAxisTitle,
						yAxisTitle, dataPkg);
				break;
			case NetworkStats.LINK:
				this.createLinkSetChart(style, display, title, xAxisTitle,
						yAxisTitle, dataPkg);
				break;
			case NetworkStats.DEGREE_DISTRIBUTION:
				this.createDegreeDistributionChart(style, display, title,
						xAxisTitle, yAxisTitle, dataPkg.getNetworkPkg()
								.getNetworkStats().getDegreeDistribution());
				break;
			}
		} catch (Exception ee) {
			return;
		}
	}

	public void create(String style, Display display, String title,
			String xAxisTitle, String yAxisTitle, DataPkg dataPkg, Flow flow) {
		try {
			title = title + ": " + style;
			switch (style) {
			case NetworkStats.NAME:
				this.createNameChart(style, display, title, xAxisTitle,
						yAxisTitle, dataPkg, flow);
				break;
			case NetworkStats.FLOW:
				this.createFlowSetChart(style, display, title, xAxisTitle,
						yAxisTitle, dataPkg, flow);
				break;
			case NetworkStats.NODE:
				this.createNodeSetChart(style, display, title, xAxisTitle,
						yAxisTitle, dataPkg, flow);
				break;
			case NetworkStats.SERVICE:
				this.createServiceSetChart(style, display, title, xAxisTitle,
						yAxisTitle, dataPkg, flow);
				break;
			case NetworkStats.LINK:
				this.createLinkSetChart(style, display, title, xAxisTitle,
						yAxisTitle, dataPkg, flow);
				break;
			}
		} catch (Exception ee) {
			return;
		}
	}

	private void createNameChart(String style, Display display, String title,
			String xAxisTitle, String yAxisTitle, DataPkg dataPkg) {

	}

	private void createNameChart(String style, Display display, String title,
			String xAxisTitle, String yAxisTitle, DataPkg dataPkg, Flow flow) {

	}

	private void createFlowSetChart(String style, Display display,
			String title, String xAxisTitle, String yAxisTitle, DataPkg dataPkg) {

	}

	private void createFlowSetChart(String style, Display display,
			String title, String xAxisTitle, String yAxisTitle,
			DataPkg dataPkg, Flow flow) {

	}

	private void createNodeSetChart(String style, Display display,
			String title, String xAxisTitle, String yAxisTitle, DataPkg dataPkg) {

	}

	private void createNodeSetChart(String style, Display display,
			String title, String xAxisTitle, String yAxisTitle,
			DataPkg dataPkg, Flow flow) {

	}

	private void createServiceSetChart(String style, Display display,
			String title, String xAxisTitle, String yAxisTitle, DataPkg dataPkg) {

	}

	private void createServiceSetChart(String style, Display display,
			String title, String xAxisTitle, String yAxisTitle,
			DataPkg dataPkg, Flow flow) {

	}

	private void createLinkSetChart(String style, Display display,
			String title, String xAxisTitle, String yAxisTitle, DataPkg dataPkg) {

	}

	private void createLinkSetChart(String style, Display display,
			String title, String xAxisTitle, String yAxisTitle,
			DataPkg dataPkg, Flow flow) {

	}

	private void createDegreeDistributionChart(String style, Display display,
			String title, String xAxisTitle, String yAxisTitle,
			TreeMap<Integer, ArrayList<Node>> dis) {
		StatsChart.getInstance().drawDistributionChart(display, title,
				xAxisTitle, yAxisTitle, dis);
	}
}
